#include	<QGraphicsDropShadowEffect>
#include	"myButton.h"

myButton::myButton(QWidget *parent):
    QLabel(parent)
{
    QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect(this);
    shadowEffect->setBlurRadius(3);
    shadowEffect->setXOffset(3);
    shadowEffect->setYOffset(3);

    setGraphicsEffect(shadowEffect);

    setFrameStyle(QFrame::Panel|QFrame::Raised);
    setLineWidth(2);

    setMinimumSize(80, 30);
    setAlignment(Qt::AlignCenter);

    QFont ft;
    ft.setPixelSize(13);
    setFont(ft);

    QPalette background;
    background.setColor(QPalette::WindowText, QColor(60,60,60));
    setPalette(background);

    setStyleSheet("background-color:#999;color:darkblue;border-radius:15px;");
}

myButton::~myButton(void)
{
}

void myButton::mouseReleaseEvent(QMouseEvent *ev)
{
    Q_UNUSED(ev)
    setStyleSheet("background-color:#999;color:darkblue;border-radius:15px;");
    emit clicked(this->text());
}

void myButton::mousePressEvent(QMouseEvent *ev)
{
    Q_UNUSED(ev)
    setStyleSheet("background-color:darkblue;color:yellow;border-radius:15px;");
}

void myButton::highLight(bool b)
{
    if(b)
    {
        setStyleSheet("background-color:#999;color:darkblue;border-radius:15px;");
    }
    else
    {
        setStyleSheet("background-color:#999;color:#bbb;border-radius:15px;");
    }

}
